package br.com.viewcar.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import br.com.viewcar.entity.Permissao;
import br.com.viewcar.util.CheckrotaUtil;

@Repository
@Transactional
public class PermissaoService extends BaseService<Integer, Permissao> {

	@Transactional(readOnly = true)
	public List<Permissao> retrieveAll() {

		List<Permissao> result = new ArrayList<Permissao>();

		if (CheckrotaUtil.isAdministradorSistema()) {
			result = super.retrieveAll();
		}
		Permissao permissao = new Permissao();
		permissao.setId(1);
		result.remove(permissao);
		permissao = new Permissao();
		permissao.setId(23);
		result.remove(permissao);
		return result;
	}
}